package com.one.square.user.interfaces.service.fallback;

import com.one.square.core.domain.Result;
import com.one.square.core.entity.SysMenu;
import com.one.square.user.interfaces.service.service.SysMenuInterface;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;

import java.util.List;

/**
 * @author cwm
 * @Description
 * @date 2021/10/27 上午9:21
 * @Version 1.0
 */
@Slf4j
public class SysMenuInterfaceFallBack implements FallbackFactory<SysMenuInterface> {
    @Override
    public SysMenuInterface create(Throwable cause) {
        return new SysMenuInterface() {
            @Override
            public Result<List<SysMenu>> findByRoleCodes(List<String> roleCodes) {
                log.error("通过角色code查询菜单异常:{}", roleCodes, cause);
                return Result.failed("通过角色code查询菜单异常");
            }
        };
    }
}
